﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Webchenzd.Models;

namespace Webchenzd.Controllers
{
    [Route("sb/Std")]
    [ApiController]
    public class StudentController : ControllerBase
    {
        // GET: api/Student
        [HttpGet]
        public IEnumerable<Student> Get()
        {
            return Students;
        }

        // GET: api/Student/5
        [HttpGet("{id}", Name = "Get")]
        public Student Get(int id)
        {
            return Students.FirstOrDefault((std)=> { return std.Id == id; });
        }

        // POST: api/Student
        [HttpPost]
        public void Post([FromBody] string value)
        {
        }

        // PUT: api/Student/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
            
        }

        // DELETE: api/ApiWithActions/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }



        private List<Student> Students = new List<Student>()
        {
            new Student(){Id=1,Name="陈哲栋",Grade="三年级",Height=165},
            new Student(){Id=2,Name="周醒醒",Grade="二年级",Height=165},
            new Student(){Id=3,Name="艾蛋蛋",Grade="一年级",Height=165}
        };
    }
}
